package com.tm.gulimall.coupon.nacosprovider;

import com.tm.common.utils.R;
import com.tm.gulimall.coupon.entity.CouponEntity;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("nacos/coupon")
public class NacosConfigController {

    @Value("${coupon.user.name}")
    private String name;
    @Value("${coupon.user.age}")
    private String age;

    @GetMapping("/config")
    public R nacosConfig(){
        return R.ok().put("name",name).put("age",age);
    }

    @GetMapping("/coupons")
    public R coupons(){
        CouponEntity couponEntity = new CouponEntity();
        couponEntity.setCouponName("满一百减十块");
        return R.ok().put("couponEntity",couponEntity);
    }
}
